package com.scorpio.user.controller;


import com.scorpio.tools.api.R;
import com.scorpio.tools.generator.BaseController;
import com.scorpio.user.entity.User;
import com.scorpio.user.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


import java.util.List;

/**
 * <p>
 * 用户表 前端控制器
 * </p>
 *
 * @author autoCode
 * @since 2020-01-13
 */
@RestController
@RequestMapping("/user/user")
public class UserController extends BaseController {

    @Autowired
    private IUserService iUserService;

    @GetMapping("/list")
    public R list() {
        return R.data(iUserService.getAll());
    }

    @PostMapping("/add")
    public R add(@RequestBody List<User> users) {
        return R.data(iUserService.addUsers(users));
    }
}
